package org.jeecg.modules.business.outbound.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.outbound.entity.WmsOutReceiptTask;
import org.jeecg.modules.business.outbound.entity.WmsOutReceiptTaskMaterial;
import org.jeecg.modules.business.outbound.entity.vo.*;
import org.jeecg.modules.business.outbound.entity.dto.ListWmsOutReceiptDTO;
import org.jeecg.modules.business.outbound.vo.WmsOutReceiptTaskMaterialResponseVO;
import org.jeecg.modules.business.warehouse.entity.InspectResultVO;
import org.jeecg.modules.flow.callback.enums.SimpleDocumentTypeEnum;
import org.jeecg.modules.flow.callback.enums.TransferStatusEnum;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 出库任务
 * @Author: jeecg-boot
 * @Date: 2023-08-09
 * @Version: V1.0
 */
public interface IWmsOutReceiptTaskService extends IService<WmsOutReceiptTask> {

    /**
     * 添加一对多
     *
     * @param wmsOutReceiptTask
     * @param wmsOutReceiptTaskMaterialList
     */
    public String saveMain(WmsOutReceiptTask wmsOutReceiptTask, List<WmsOutReceiptTaskMaterial> wmsOutReceiptTaskMaterialList);

    /**
     * 修改一对多
     *
     * @param wmsOutReceiptTask
     * @param wmsOutReceiptTaskMaterialList
     */
    public void updateMain(WmsOutReceiptTask wmsOutReceiptTask, List<WmsOutReceiptTaskMaterial> wmsOutReceiptTaskMaterialList);

    /**
     * 删除一对多
     *
     * @param id
     */
    public void delMain(String id);

    /**
     * 批量删除一对多
     *
     * @param idList
     */
    public void delBatchMain(Collection<? extends Serializable> idList);

    /**
     * 出库任务下查
     *
     * @param wmsOutReceiptId
     * @return
     */
    ListWmsOutReceiptDTO listWmsOutReceipt(String wmsOutReceiptId);
    /**
     * 分页列表查询
     *
     * @author hansen
     * @since 2023/11/14 13:54
     * @param page
     * @param wmsOutReceiptTask
     * @return com.baomidou.mybatisplus.core.metadata.IPage<org.jeecg.modules.business.outbound.entity.WmsOutReceiptTask>
     */
    IPage<WmsOutReceiptTaskPageVO> listByPage(IPage<WmsOutReceiptTask> page, WmsOutReceiptTaskQueryVO wmsOutReceiptTask);

    /**
     * 通过出库任务id 获取物料即时库存位置信息
     * @param taskMaterialId
     * @return
     */
    RepertorySimpleVO getMaterialRepertoryInfoByOutId(String taskMaterialId);

    void outboundInspect(InspectResultVO inspectResultVO);

    /**
     * 找出已提交超过24小时的销售出库任务，并警告
     */
    void outboundTaskXSCKWarning();

    /**
     * 当保存时获取过账状态
     * @return
     */
    TransferStatusEnum getTransferStatusWhenSave(SimpleDocumentTypeEnum simpleDocumentType,String docuemntType);

    /**
     * 更新过账状态
     * @param simpleDocumentType
     * @param taskId
     * @param receiptId
     * @param transferStatus
     */
    void updateTransferStatus(SimpleDocumentTypeEnum simpleDocumentType,String taskId,String receiptId,TransferStatusEnum transferStatus);


    Result getMaterialRepertory(String taskMaterialId);

    /**
     * 出库任务或者出库单过账
     * @param taskId
     * @param receiptId
     * @return
     */
    List<String> outTaskAndReceiptTransfer(String taskId, String receiptId);

    /**
     * 检查物料是否存在在执行中的入库任务中
     * @param checkMaterialVOList
     * @return
     */
    NoticeInTaskVO checkMaterialExistProcessInTask(List<CheckMaterialVO> checkMaterialVOList);

    /**
     * 出库任务-物料主表ID查询
     * @param id
     * @param code
     * @param unCompleted
     * @param pdaFilterFlag
     * @return
     */
    List<WmsOutReceiptTaskMaterialResponseVO> queryWmsOutReceiptTaskMaterialListByMainId(String id, String code, Boolean unCompleted, Boolean pdaFilterFlag);

    /**
     * 出库任务-物料主表ID查询（带即时库存）
     * @param pdaTaskMaterialReqVO
     * @return
     */
    List<WmsOutReceiptTaskMaterialResponseVO> pdaQueryTaskMaterialByTaskId(PdaTaskMaterialReqVO pdaTaskMaterialReqVO);

    /**
     * pda视觉识别鞍座
     *
     * @param id
     * @return void
     * @author hansen
     * @since 2024/1/26 13:14
     */
    Result<Result<String>> pdaSignalTrigger(String id, String saddle);

}
